package com.mmx.extension.def;

import cn.hutool.core.collection.ListUtil;
import com.mmx.domain.bean.NodeData;
import com.mmx.extension.AbstractApprover;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @desc: 默认审批人
 * @author: liushuai
 * @date: 2023/2/8 11:05
 */
@Service
public class DefaultApprover extends AbstractApprover {
    @Override
    public List<String> customApprover(NodeData nodeData, Map<String, Object> variables) {
        Object obj =  variables.get(nodeData.getId());
        if(obj instanceof String){
            String str = (String) obj;
            String[] assignees = str.split(",");
            ArrayList<String> assigneeList = ListUtil.toList(assignees);
            return  assigneeList;
        }
        return ListUtil.empty();
    }
}
